package com.mg.persional.service.impl;

import com.mg.common.vo.ResponseResult;
import com.mg.common.vo.ResponseStatus;
import com.mg.persional.entity.TbMyTiktok;
import com.mg.persional.mapper.TbMyTiktokMapper;
import com.mg.persional.service.TbMyTiktokService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TbMyTiktokServiceImpl implements TbMyTiktokService {
    @Autowired
    TbMyTiktokMapper tbMyTiktokMapper;
    //根据抖音号进行查询
    @Override
    public ResponseResult<String> getById(String mtMyTiktok) {
        ResponseResult entity = null;
        ResponseResult<String> byId = tbMyTiktokMapper.getById(mtMyTiktok);
        if (byId != null){
            entity = ResponseResult.ok(byId);
        }else {
            entity = ResponseResult.error(ResponseStatus.SERVICE_ERROR);
        }
        return entity;
    }

    //
    @Override
    public ResponseResult<TbMyTiktok> getByKeyWords(String mtNickname) {
        ResponseResult<TbMyTiktok> entity = null;
        //
        List<TbMyTiktok> nickName = tbMyTiktokMapper.getByMtNickName(mtNickname);
        if (nickName != null){
            entity = ResponseResult.ok(nickName);
        }else {
            entity = ResponseResult.error(ResponseStatus.SERVICE_ERROR);
        }
        return entity;
    }
}
